/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.bits;

import info.peigen.hotpot.component.gateway.dianlan.bits.base.BitParserBase;
import info.peigen.hotpot.component.gateway.dianlan.protocol.passive.DianlanChargingSocketTemperatureDataGram;

/**
 * <b>(DianlanChargingSocketTemperatureDataGramReasonBits)</b>
 * <p>
 * 充电插座温度报文-解析
 *
 * @author LiDaHai
 * @version 1.0.0
 * @since 2023/1/12
 */
public class DianlanChargingSocketTemperatureDataGramReasonBits extends BitParserBase {

    public DianlanChargingSocketTemperatureDataGram parseReason(String hexString) {
        String[]                                 hexStrArray = hexStrToArray(hexString);
        DianlanChargingSocketTemperatureDataGram info        = DianlanChargingSocketTemperatureDataGram.builder().build();
        info.setCheck1Plus(parseInt(hexStrArray[0]) + (-40));
        info.setCheck1Minus(parseInt(hexStrArray[1]) + (-40));
        info.setCheck2Plus(parseInt(hexStrArray[2]) + (-40));
        info.setCheck2Minus(parseInt(hexStrArray[3]) + (-40));
        info.setReserve(hexStrArray[3] + hexStrArray[4] + hexStrArray[5] + hexStrArray[6]);
        return info;
    }
}